"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = Example1;

var _design = require("@discuzq/design");

var _react = _interopRequireDefault(require("react"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }

function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }

function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }

function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }

function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }

function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }

var html = "\n<p><span id=\"topic\" value=\"191\">#\u57FA\u7840\u89E3\u6790#</span></p><br />\n<blockquote><p>\u672C\u6587\u6863\u5C06\u6307\u5BFC\u60A8\u5982\u4F55\u5728\u5DF2\u5B89\u88C5\u5B9D\u5854\u9762\u677F\u7684 Linux \u670D\u52A1\u5668\u4E0A\u5B89\u88C5\u90E8\u7F72 DIscuz\uFF01Q\u3002</p></blockquote>\n<hr />\n<p>123<br />\n123<br />\n\xA0</p>\n<hr />\n<a href=\"javascript:alert('xss')\">click me</a>\n<a href=\"alert('xss')\">fresh</a>\n<h1>\u4E00\u7EA7\u6807\u9898</h1>\n<h2>\u4E8C\u7EA7\u6807\u9898</h2>\n<h3>\u4E09\u7EA7\u6807\u9898</h3>\n<h4>\u56DB\u7EA7\u6807\u9898</h4>\n<h5>\u4E94\u7EA7\u6807\u9898</h5>\n<h6>\u516D\u7EA7\u6807\u9898</h6>\n<p>\u6BB5\u843D\u6BB5\u843D\u6BB5\u843D\u6BB5\u843D\u6BB5\u843D\u6BB5\u843D\u6BB5\u843D\u6BB5\u843D\u6BB5\u843D\u6BB5\u843D\u6BB5\u843D\u6BB5\u843D\u6BB5\u843D\u6BB5\u843D\u6BB5\u843D\u6BB5\u843D\u6BB5\u843D\u6BB5\u843D\u6BB5\u843D\u6BB5\u843D\u6BB5\u843D\u6BB5\u843D\u6BB5\u843D\u6BB5\u843D\u6BB5\u843D\u6BB5\u843D\u6BB5\u843D\u6BB5\u843D\u6BB5\u843D</p>\n<p>\u6BB5\u843D\u6BB5\u843D\u6BB5\u843D\u6BB5\u843D\u6BB5\u843D\u6BB5\u843D\u6BB5\u843D\u6BB5\u843D\u6BB5\u843D\u6BB5\u843D\u6BB5\u843D\u6BB5\u843D\u6BB5\u843D\u6BB5\u843D\u6BB5\u843D\u6BB5\u843D\u6BB5\u843D\u6BB5\u843D\u6BB5\u843D\u6BB5\u843D\u6BB5\u843D\u6BB5\u843D\u6BB5\u843D\u6BB5\u843D\u6BB5\u843D\u6BB5\u843D\u6BB5\u843D\u6BB5\u843D</p>\n<p><strong>\u6BB5\u843D\u6BB5\u843D</strong>\u6BB5\u843D\u6BB5\u843D\u6BB5\u843D\u6BB5\u843D\u6BB5\u843D\u6BB5\u843D\u6BB5\u843D\u6BB5\u843D\u6BB5\u843D\u6BB5\u843D\u6BB5\u843D\u6BB5\u843D\u6BB5\u843D\u6BB5\u843D\u6BB5\u843D\u6BB5\u843D\u6BB5\u843D\u6BB5\u843D\u6BB5\u843D\u6BB5\u843D\u6BB5\u843D\u6BB5\u843D\u6BB5\u843D\u6BB5\u843D\u6BB5\u843D</p>\n\n<code>const helloWorld = function() {\n  console.log('hello world');\n}</code>\n\n<p>\n    <img width='200' height='200' src=\"https://main.qcloudimg.com/raw/9c701525249863334dbd86397b49a11d.jpg\" alt=\"\u56FE\u7247\" />\n</p>\n\n<iframe frameborder=\"no\" border=\"0\" marginwidth=\"0\" marginheight=\"0\" width=\"330\" height=\"86\" src=\"https://music.163.com/outchain/player?type=2&id=1417244828&auto=1&height=66\"></iframe>\n<script>123</script>\n";

function Example1() {
  var _React$useState = _react.default.useState(html),
      _React$useState2 = _slicedToArray(_React$useState, 2),
      renderContent = _React$useState2[0],
      setRenderContent = _React$useState2[1];

  var whiteList = ['bilibili', '163.com'];
  return /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_design.RichText, {
    onParse: function onParse(nodeTree, imgUrls) {
      console.log(nodeTree, imgUrls);
    },
    onImgClick: function onImgClick(node) {
      alert('图片被点击了');
    },
    content: renderContent,
    iframeWhiteList: whiteList
  }));
}